closeDiv();
// 开启库存批次
function kaiqiKucunpc() {
	$.ajax({
		type: "POST",
	    url: path + "/zsShezhi/kaiqiKucunpc",
	    async: false,
	    //请求成功完成后要执行的方法
	    success: function(data){
	    	if(data == MSG_SUCCESS){
				var msg;
				var sjc = new Date();
	    		msg = encodeURI(encodeURI("开启批次成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt' + '&msg=' + msg + '&sjc=' + sjc;	    		
	    	}else{
	    		notifyDanger('开启批次失败');
	    	}
	    }
	});
}

//关闭库存批次
function guanbiKucunpc() {
	$.ajax({
		type: "POST",
	    url: path + "/zsShezhi/guanbiKucunpc",
	    async: false,
	    //请求成功完成后要执行的方法
	    success: function(data){
	    	if(data == MSG_SUCCESS){
				var msg;
				var sjc = new Date();
	    		msg = encodeURI(encodeURI("关闭批次成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt' + '&msg=' + msg + '&sjc=' + sjc;	    		
	    	}else{
	    		notifyDanger('关闭批次失败');
	    	}
	    }
	});
}

//开启医保开关
function openYiBaokg() {
    $.ajax({
        type: "POST",
        url: path + "/zsShezhi/openYiBaokg",
        async: false,
        //请求成功完成后要执行的方法
        success: function (data) {
            if (data == MSG_SUCCESS) {
				var msg;
				var sjc = new Date();
            	$('#isYiBao').val(1);
                msg = encodeURI(encodeURI('开启医保成功，请在医保设置模块填写医疗机构编号后重启'));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt' + '&msg=' + msg + '&sjc=' + sjc;                
            } else {
                notifyDanger('开启医保失败');
                
            }
        }
    });
}

// 关闭医保开关
function closeYiBaokg() {
    $.ajax({
        type: "POST",
        url: path + "/zsShezhi/closeYiBaokg",
        async: false,
        //请求成功完成后要执行的方法
        success: function(data){
            if (data == MSG_SUCCESS) {
				var msg;
				var sjc = new Date();
            	$('#isYiBao').val(0);
            	msg = encodeURI(encodeURI("关闭医保成功"));
 				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt' + '&msg=' + msg + '&sjc=' + sjc;            	
            } else {
                notifyDanger('开启医保失败');
            }
        }
    });
}

//开启自动建库开关
function openZidongjk(){
	$.ajax({
		url: path + '/zsShezhi/openZidongjk',
		type: 'post',
		async: false,
		success: function(data){
	        if (data == MSG_SUCCESS) {
				var msg;
				var sjc = new Date();
	            msg = encodeURI(encodeURI("开启自动建库成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt'+ '&msg=' + msg + '&sjc=' + sjc;	            
	        } else {
	            notifyDanger('开启自动建库失败');
	        }
		}
	});
}

//关闭自动建库开关
function closeZidongjk(){
	$.ajax({
		url: path + '/zsShezhi/closeZidongjk',
		type: 'post',
		async: false,
		success: function(data){
	        if (data == MSG_SUCCESS) {
				var msg;
				var sjc = new Date();
	            msg = encodeURI(encodeURI("关闭自动建库成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt'+ '&msg=' + msg + '&sjc=' + sjc;	            
	        } else {
	            notifyDanger('关闭自动建库失败');
	        }
		}
	});
}

//开启欠费开关
function openQianfei(){
	$.ajax({
		url: path + '/zsShezhi/openQianfei',
		type: 'post',
		async: false,
		success: function(data){
		    if (data == MSG_SUCCESS) {
				var msg;
				var sjc = new Date();
		        msg = encodeURI(encodeURI("开启欠费成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt'+ '&msg=' + msg + '&sjc=' + sjc;		        
		    } else {
		        notifyDanger('开启欠费失败');
		    }
		}
	});
}

//关闭欠费开关
function closeQianfei(){
	$.ajax({
		url: path + '/zsShezhi/closeQianfei',
		type: 'post',
		async: false,
		success: function(data){
		    if (data == MSG_SUCCESS) {
				var msg;
				var sjc = new Date();
		        msg = encodeURI(encodeURI("关闭欠费成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp?yemianrk=shezhixt'+ '&msg=' + msg + '&sjc=' + sjc;		        
		    } else {
		        notifyDanger('关闭欠费失败');
		    }
		}
	});
}
//开启挂号开关
function kaiqiGuaHao() {
	$.ajax({
		type: "POST",
	    url: path + '/zsShezhi/openGuaHao',
	    async: false,
	    //请求成功完成后要执行的方法
	    success: function(data){
	    	if(data == MSG_SUCCESS){
				var msg;
				var sjc = new Date();
	    		msg = encodeURI(encodeURI("开启挂号成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp';	    		
	    	}else{
	    		notifyDanger('开启挂号失败');
	    	}
	    }
	});
}

//关闭挂号批次
function guanbiGuaHao() {
	$.ajax({
		type: "POST",
	    url: path + '/zsShezhi/closeGuaHao',
	    async: false,
	    //请求成功完成后要执行的方法
	    success: function(data){
	    	if(data == MSG_SUCCESS){
				var msg;
				var sjc = new Date();
	    		msg = encodeURI(encodeURI("关闭挂号成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp';	    		
	    	}else{
	    		notifyDanger('关闭挂号失败');
	    	}
	    }
	});
}

//开启发药开关
function kaiqiFaYao() {
	$.ajax({
		type: "POST",
	    url: path + "/zsShezhi/openFaYao",
	    async: false,
	    //请求成功完成后要执行的方法
	    success: function(data){
	    	if(data == MSG_SUCCESS){
				var msg;
				var sjc = new Date();
	    		msg = encodeURI(encodeURI("开启发药成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp';	    		
	    	}else{
	    		notifyDanger('开启发药失败');
	    	}
	    }
	});
}

//关闭发药批次
function guanbiFaYao() {
	$.ajax({
		type: "POST",
	    url: path + "/zsShezhi/closeFaYao",
	    async: false,
	    //请求成功完成后要执行的方法
	    success: function(data){
	    	if(data == MSG_SUCCESS){
				var msg;
				var sjc = new Date();
	    		msg = encodeURI(encodeURI("关闭发药成功"));
				window.location.href = path + '/views/xitong-shezhi/shezhixt.jsp';	    		
	    	}else{
	    		notifyDanger('关闭发药失败');
	    	}
	    }
	});
}

function kaiguanpd(obj){
	var background = obj.css('background-color');
	console.log(background);
	if(background == "rgb(255, 255, 255)")
		return true;// 开启
	return false;// 关闭
}

$("#pici-kaiguan").click(function(){
	if($('#pici-kaiguan').hasClass("kaiqi")){
		$('#shezhixt-out').find('.modal-title').html('关闭后，分批入库的信息将合并处理。<p style="color:#ff0000;margin:0;padding:0;">警告：关闭批次后，该诊所将永久无法开启批次，请慎重操作！</p>');
	}else{
		$('#shezhixt-out').find('.modal-title').text('开启后，库存将按照入库批次进行管理。');
	}
	$('#shezhixt-out').modal('toggle');
});

$("#yibao-kaiguan").click(function(){
	if($('#yibao-kaiguan').hasClass("kaiqi")){
		$('#shezhixt-yibaokg').find('.modal-title').text('关闭后，不可操作医保模块。');
	}else{
		$('#shezhixt-yibaokg').find('.modal-title').text('开启后，打开医保模块。');
	}
	$('#shezhixt-yibaokg').modal('toggle');
});

//点击自动建库开关
$("#zidongjk-kaiguan").click(function(){
	if($('#zidongjk-kaiguan').hasClass("kaiqi")){
		$('#shezhixt-zidongjk').find('.modal-title').text('关闭后，自动建库功能将关闭。');
	}else{
		$('#shezhixt-zidongjk').find('.modal-title').text('开启后，自动建库功能将开启。');
	}
	$('#shezhixt-zidongjk').modal('toggle');
});

//点击欠费开关
$("#qianfei-kaiguan").click(function(){
	if($('#qianfei-kaiguan').hasClass("kaiqi")){
		$('#shezhixt-qianfei').find('.modal-title').text('关闭后，将没有欠费相关功能。');
	}else{
		$('#shezhixt-qianfei').find('.modal-title').text('开启后，将开启欠费相关功能。');
	}
	$('#shezhixt-qianfei').modal('toggle');
});

//点击挂号开关
$("#guahao-kaiguan").click(function(){
	if($('#guahao-kaiguan').hasClass("kaiqi")){
		$('#shezhixt-guahao').find('.modal-title').text('关闭后，将没有挂号相关功能。');
	}else{
		$('#shezhixt-guahao').find('.modal-title').text('开启后，将开启挂号相关功能。');
	}
	$('#shezhixt-guahao').modal('toggle');
});

//点击发药开关
$("#fayao-kaiguan").click(function(){
	if($('#fayao-kaiguan').hasClass("kaiqi")){
		$('#shezhixt-fayao').find('.modal-title').text('关闭后，将没有发药相关功能。');
	}else{
		$('#shezhixt-fayao').find('.modal-title').text('开启后，将开启发药相关功能。');
	}
	$('#shezhixt-fayao').modal('toggle');
});

$('#shezhixt-out-queding').click(function(){
	if($('#pici-kaiguan').hasClass("kaiqi")){// 关闭
		$('#pici-kaiguan').removeClass("kaiqi");
		$('#pici-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
		$(".piliangkc-box .biaoshi").text("已关闭,无法开启").css("color","#777");
		$(".piliangkc-box .header-title p").css("color","#aaa");
		$(".piliangkc-box .yuanjiao ").css("background-color","#efefef");
		$('#pici-kaiguan').css('display','none');
		guanbiKucunpc(); 
	}else {
		$('#pici-kaiguan').addClass("kaiqi");
		$('#pici-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
		$(".piliangkc-box .biaoshi").text("已开启").css("color","#00b472");
		$(".piliangkc-box .header-title p").css("color","#777");
		$(".piliangkc-box .yuanjiao ").css("background-color","#efefef");
		kaiqiKucunpc();
	};
	$('#shezhixt-out').modal('hide');
});

$('#shezhixt-yibaokg-queding').click(function(){
	if($('#yibao-kaiguan').hasClass("kaiqi")){// 关闭
		$('#yibao-kaiguan').removeClass("kaiqi");
		$('#yibao-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
		$(".yibaokg-box .biaoshi").text("已关闭").css("color","#777");
		$(".yibaokg-box .header-title p").css("color","#aaa");
		$(".yibaokg-box .yuanjiao ").css("background-color","#efefef");
		closeYiBaokg();
	}else {
		$('#yibao-kaiguan').addClass("kaiqi");
		$('#yibao-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
		$(".yibaokg-box .biaoshi").text("已开启").css("color","#00b472");
		$(".yibaokg-box .header-title p").css("color","#777");
		$(".yibaokg-box .yuanjiao ").css("background-color","#efefef");
		openYiBaokg();
	};
	$('#shezhixt-yibaokg').modal('hide');
});

//点击自动建库的确定按钮
$('#shezhixt-zidongjk-queding').click(function(){
	if($('#zidongjk-kaiguan').hasClass("kaiqi")){// 关闭
		$('#zidongjk-kaiguan').removeClass("kaiqi");
		$('#zidongjk-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
		$(".zidongjk-box .biaoshi").text("已关闭").css("color","#777");
		$(".zidongjk-box .header-title p").css("color","#aaa");
		$(".zidongjk-box .yuanjiao ").css("background-color","#efefef");
		closeZidongjk();
	}else {
		$('#zidongjk-kaiguan').addClass("kaiqi");
		$('#zidongjk-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
		$(".zidongjk-box .biaoshi").text("已开启").css("color","#00b472");
		$(".zidongjk-box .header-title p").css("color","#777");
		$(".zidongjk-box .yuanjiao ").css("background-color","#efefef");
		openZidongjk();
	};
	$('#shezhixt-zidongjk').modal('hide');
});

//点击欠费的确定按钮
$('#shezhixt-qianfei-queding').click(function(){
	if($('#qianfei-kaiguan').hasClass("kaiqi")){// 关闭
		$('#qianfei-kaiguan').removeClass("kaiqi");
		$('#qianfei-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
		$(".tuifeikg-box .biaoshi").text("已关闭").css("color","#777");
		$(".tuifeikg-box .header-title p").css("color","#aaa");
		$(".tuifeikg-box .yuanjiao ").css("background-color","#efefef");
		closeQianfei();
	}else {
		$('#qianfei-kaiguan').addClass("kaiqi");
		$('#qianfei-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
		$(".tuifeikg-box .biaoshi").text("已开启").css("color","#00b472");
		$(".tuifeikg-box .header-title p").css("color","#777");
		$(".tuifeikg-box .yuanjiao ").css("background-color","#efefef");
		openQianfei();
	};
	$('#shezhixt-qianfei').modal('hide');
});

//点击挂号的确定按钮
$('#shezhixt-guahao-queding').click(function(){
	if($('#guahao-kaiguan').hasClass("kaiqi")){// 关闭
		$('#guahao-kaiguan').removeClass("kaiqi");
		$('#guahao-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
		$(".guahao-box .biaoshi").text("已关闭").css("color","#777");
		$(".guahao-box .header-title p").css("color","#aaa");
		$(".guahao-box .yuanjiao ").css("background-color","#efefef");
		guanbiGuaHao();
	}else {
		$('#guahao-kaiguan').addClass("kaiqi");
		$('#guahao-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
		$(".guahao-box .biaoshi").text("已开启").css("color","#00b472");
		$(".guahao-box .header-title p").css("color","#777");
		$(".guahao-box .yuanjiao ").css("background-color","#efefef");
		kaiqiGuaHao();
	};
	$('#shezhixt-guahao').modal('hide');
});

//点击发药的确定按钮
$('#shezhixt-fayao-queding').click(function(){
	if($('#fayao-kaiguan').hasClass("kaiqi")){// 关闭
		$('#fayao-kaiguan').removeClass("kaiqi");
		$('#fayao-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
		$(".fayao-box .biaoshi").text("已关闭").css("color","#777");
		$(".fayao-box .header-title p").css("color","#aaa");
		$(".fayao-box .yuanjiao ").css("background-color","#efefef");
		guanbiFaYao();
	}else {
		$('#fayao-kaiguan').addClass("kaiqi");
		$('#fayao-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
		$(".fayao-box .biaoshi").text("已开启").css("color","#00b472");
		$(".fayao-box .header-title p").css("color","#777");
		$(".fayao-box .yuanjiao ").css("background-color","#efefef");
		kaiqiFaYao();
	};
	$('#shezhixt-fayao').modal('hide');
});

// 获取设置
function getShezhi(piliangkckg, isYiBao, YiBaokg, zidongjkkg, qianfeikg, guahaokg, fayaokg){
	$.ajax({
		type:"POST",
	    url:path+"/zsShezhi/getShezhi",
	    dataType:'json',
	    //请求成功完成后要执行的方法
	    success: function(data){
	    	if(data != '') {
	    		$(data).each(function(){
	    			console.log(data)
	    			if(this.daima == piliangkckg ) {// 批量库存开关
	    				$('#pkucunpckgsm').text(this.shuoming);
	    				if(this.zhi == 0) {// 关闭
	    			        $('#pici-kaiguan').removeClass("kaiqi");
	    			        $('#pici-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
	    			        $(".piliangkc-box .biaoshi").text("已关闭,无法开启").css("color","#777");
	    			        $(".piliangkc-box .header-title p").css("color","#aaa");
	    			        $(".piliangkc-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#pici-kaiguan').css("display","none");
	    				}else{
	    			        $('#pici-kaiguan').addClass("kaiqi");
	    			        $('#pici-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
	    			        $(".piliangkc-box .biaoshi").text("已开启").css("color","#00b472");
	    			        $(".piliangkc-box .header-title p").css("color","#777");
	    			        $(".piliangkc-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#pici-kaiguan').css("display","inline-block");
	    				}
	    			}
	    			if (this.daima == YiBaokg) {
	    			    $('#yibaoshuom').text(this.shuoming).append('<span class="xiazaikhd" id="downloadyibaokhd">  点击此处下载医保客户端</span>');
                        if(this.zhi == 0) {// 关闭
                            $('#yibao-kaiguan').removeClass("kaiqi");
                            $('#yibao-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
                            $(".yibaokg-box .biaoshi").text("已关闭").css("color","#777");
                            $(".yibaokg-box .header-title p").css("color","#aaa");
                            $(".yibaokg-box .yuanjiao ").css("background-color","#efefef");
                            $('#yibao-kaiguan').css("display","inline-block");
                        }else{
                            $('#yibao-kaiguan').addClass("kaiqi");
                            $('#yibao-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
                            $(".yibaokg-box .biaoshi").text("已开启").css("color","#00b472");
                            $(".yibaokg-box .header-title p").css("color","#777");
                            $(".yibaokg-box .yuanjiao ").css("background-color","#efefef");
                            $('#yibao-kaiguan').css("display","inline-block");
                        }
	    			}
	    			if(this.daima == zidongjkkg ) {// 自动建库开关
	    				if(this.zhi == 0) {// 关闭
	    			        $('#zidongjk-kaiguan').removeClass("kaiqi");
	    			        $('#zidongjk-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
	    			        $(".zidongjk-box .biaoshi").text("已关闭").css("color","#777");
	    			        $(".zidongjk-box .header-title p").css("color","#aaa");
	    			        $(".zidongjk-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#zidongjk-kaiguan').css("display","inline-block");
	    				}else{
	    			        $('#zidongjk-kaiguan').addClass("kaiqi");
	    			        $('#zidongjk-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
	    			        $(".zidongjk-box .biaoshi").text("已开启").css("color","#00b472");
	    			        $(".zidongjk-box .header-title p").css("color","#777");
	    			        $(".zidongjk-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#zidongjk-kaiguan').css("display","inline-block");
	    				}
	    			}
	    			if(this.daima == qianfeikg ) {// 欠费开关
	    				if(this.zhi == 0) {// 关闭
	    			        $('#qianfei-kaiguan').removeClass("kaiqi");
	    			        $('#qianfei-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
	    			        $(".tuifeikg-box .biaoshi").text("已关闭").css("color","#777");
	    			        $(".tuifeikg-box .header-title p").css("color","#aaa");
	    			        $(".tuifeikg-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#qianfei-kaiguan').css("display","inline-block");
	    				}else{
	    			        $('#qianfei-kaiguan').addClass("kaiqi");
	    			        $('#qianfei-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
	    			        $(".tuifeikg-box .biaoshi").text("已开启").css("color","#00b472");
	    			        $(".tuifeikg-box .header-title p").css("color","#777");
	    			        $(".tuifeikg-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#qianfei-kaiguan').css("display","inline-block");
	    				}
	    			}
	    			if(this.daima == guahaokg ) {// 挂号开关
	    				if(this.zhi == 0) {// 关闭
	    			        $('#guahao-kaiguan').removeClass("kaiqi");
	    			        $('#guahao-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
	    			        $(".guahao-box .biaoshi").text("已关闭").css("color","#777");
	    			        $(".guahao-box .header-title p").css("color","#aaa");
	    			        $(".guahao-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#guahao-kaiguan').css("display","inline-block");
	    				}else{
	    			        $('#guahao-kaiguan').addClass("kaiqi");
	    			        $('#guahao-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
	    			        $(".guahao-box .biaoshi").text("已开启").css("color","#00b472");
	    			        $(".guahao-box .header-title p").css("color","#777");
	    			        $(".guahao-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#guahao-kaiguan').css("display","inline-block");
	    				}
	    			}
	    			if(this.daima == fayaokg ) {// 发药开关
	    				if(this.zhi == 0) {// 关闭
	    			        $('#fayao-kaiguan').removeClass("kaiqi");
	    			        $('#fayao-kaiguan').find(".xiaoqiu").removeClass("xiaoqiu-right");
	    			        $(".fayao-box .biaoshi").text("已关闭").css("color","#777");
	    			        $(".fayao-box .header-title p").css("color","#aaa");
	    			        $(".fayao-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#fayao-kaiguan').css("display","inline-block");
	    				}else{
	    			        $('#fayao-kaiguan').addClass("kaiqi");
	    			        $('#fayao-kaiguan').find(".xiaoqiu").addClass("xiaoqiu-right");
	    			        $(".fayao-box .biaoshi").text("已开启").css("color","#00b472");
	    			        $(".fayao-box .header-title p").css("color","#777");
	    			        $(".fayao-box .yuanjiao ").css("background-color","#efefef");
	    			        $('#fayao-kaiguan').css("display","inline-block");
	    				}
	    			}
	    		});
	    	}
	    }
	});
}

// 点击弹出医保客户端
$(document).on('click','#downloadyibaokhd',function(){
	$('#mymodal-dizhi').modal();
});

//li标签传值
$(document).on("mouseover",".dropdown-zsxxul li",function(){
	$(this).addClass("hello");
});
$(document).on("mouseout",".dropdown-zsxxul li",function(){
	$(this).removeClass("hello");
});
$(document).on("focusout",".dropdown-zsxx",function(){
	if($(".dropdown-zsxxul li").hasClass("hello")){
		$(this).siblings(".dropdown-zsxxul").css("display","block");
	}else{
		$(this).siblings(".dropdown-zsxxul").css("display","none");
	}
});

// 客户端下载
//刚登录时获取省份信息
$(function(){
	$.ajax({
		url: path + "/yibaokhxz/getShengfen",
		type: "post",
		success: function(data){
			var str = '';
			$.each(data,function(i){
				str += "<li>"+data[i]+"</li>";
			});
			$('#provinceUl').append(str);
		}
	});
});

//点击请选择省份这个框
$(document).on('click','#province',function(){
	$('#provinceUl').css('display','block');
});

//点击请选择省份中的下拉框选中需要的省份并填入框中
$(document).off('click','#provinceUl li');
$(document).on('click','#provinceUl li', function(){
	var shengfen = $(this).text();
	$('#cityUl').html('');
	$.ajax({
		url: path + '/yibaokhxz/getChengsiByShengfen',
		type: 'post',
		data: {"shengfen" : shengfen},
		success: function(data){
			var str = '';
			$.each(data,function(i){
				str += "<li>"+data[i]+"</li>";
			});
			$('#cityUl').append(str);
		}
	});
	$('#province').val(shengfen);
	$('#citys').val('');
	$('#county').val('');
	$('#provinceUl').css('display','none');
});

//点击请选择城市这个框
$(document).on('click','#citys',function(){
	$('#cityUl').css('display','block');
});

//点击请选择所在城市中的下拉框选中需要的城市并填入框中
$(document).off('click','#cityUl li');
$(document).on('click','#cityUl li', function(){
	var shengfen = $('#province').val();
	var chengshi = $(this).text();
	$('#countyUl').html('');
	$.ajax({
		url: path + '/yibaokhxz/getQuBySfAndCs',
		type: 'post',
		data: {"shengfen" : shengfen , "chengshi" : chengshi},
		success: function(data){
			var str = '';
			$.each(data,function(i){
				str += "<li>"+data[i]+"</li>";
			});
			$('#countyUl').append(str);
		}
	});
	$('#citys').val(chengshi);
	$('#county').val('');
	$('#cityUl').css('display','none');
});

//点击请选择区县这个框
$(document).on('click','#county',function(){
	$('#countyUl').css('display','block');
});

var canbaodtcqh = '';
//点击请选择所在城市中的下拉框选中需要的城市并填入框中
$(document).off('click','#countyUl li');
$(document).on('click','#countyUl li', function(){
	var shengfen = $('#province').val();
	var chengshi = $('#citys').val();
	var quxian = $(this).text();
	$.ajax({
		url: path + '/yibaokhxz/getCanbaodtcqhBySfAndCsAndQx',
		type: 'post',
		data: {"shengfen" : shengfen , "chengshi" : chengshi , "quxian" : quxian},
		success: function(data){
			canbaodtcqh = data;
		}
	});
	$('#county').val(quxian);
	$('#countyUl').css('display','none');
});

//点击医保客户端下载
$('#yibaokhdxz').click(function(){
	var shengfen = $('#province').val();
	var chengshi = $('#citys').val();
	var quxian = $('#county').val();
	var msg = {
			"shengfen": shengfen,
			"chengshi": chengshi,
			"quxian": quxian,
			"canbaodtcqh": canbaodtcqh
	};
	if((!!shengfen) && (!!chengshi) && (!!quxian)){
		$("#ayibaokhdxz").attr("href","http://139.224.11.150/aaa.zip");
		$.ajax({
			url : "./yibaokhxz/updateYibaokhxz",
			type : "post",
			data : msg,
			async : false,
			success : function(){
				notifySuccess("医保客户端下载成功");
			}
		});
	}else{
		$("#ayibaokhdxz").removeAttr("href");
		notifyWarning("省份、城市、区/县必填");
	}
	return false;
});